package com.lhs.Controller;

import com.lhs.Result.Result;
import com.lhs.entity.blog.blog_comment;
import com.lhs.service.blog_commentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/blog/blog_comment")
public class blog_commentController {

    @Autowired
    private blog_commentService blogCommentService;

    // 获取文章的评论
    @GetMapping("/getBlogComment/{postId}")
    public Result<blog_comment> getBlogComment(@PathVariable("postId") Long postId){
        return blogCommentService.getBlogComment(postId);
    }

    //发表评论
    @PostMapping("/addBlogComment/{postId}")
    public Result<String> addBlogComment(@PathVariable("postId") Long postId, @RequestBody blog_comment blogComment){
        return blogCommentService.addBlogComment(postId, blogComment);
    }

    //删除评论
    @PostMapping("/deleteBlogComment/{id}")
    public Result<String> deleteBlogComment(@PathVariable("id") Long id){
        return blogCommentService.deleteBlogComment(id);
    }


}
